<?php


namespace App\Http\Searchs\Manage\Product;


use LTools\Searchs\SearchAbstract;

class SelectSearch extends SearchAbstract
{

    /**
     * 关系映射.
     *
     * @return array
     */
    protected function relationship(): array
    {
        return [
            'search' => 'closure',
            'customer_id' => '='
        ];
    }

    /**
     * @param $value
     * @return \Closure
     */
    protected function getSearchAttribute($value)
    {
        return function ($query) use ($value) {
            $query->where('sku', 'like', "{$value}%");
        };
    }
}
